import {base_url} from "../../config/config.js"
const app = getApp()

Page({
  data: {
    swiperList: [
      "../../img/job.jpg",
      "../../img/job.jpg",
      "../../img/job.jpg"
    ],
    typeList: [{
      text: "派送",
      img: "../../img/send.png"
    },
      {
        text: "补习",
        img:"../../img/teacher.png"
      },
      {
        text: "活动",
        img: "../../img/active.png"
      },
      {
        text: "服务员",
        img: "../../img/waiter.png"
      }],
      hotlist:[
      ]
  },
  onLoad: function() {
    let that = this;
    wx.request({
      url: base_url + "/job/hotjob",
      method:"GET",
      success(res){
        console.log(res)
        let data = res.data.data;
        that.setData({
          hotlist: data
        });
      },
      fail(res){
        wx.showToast({
          title: '获取数据失败！',
          icon: "none"
        })
      }
    })
  },
  click(e){
    console.log(e)
  },
  getClassifyJobs(e){
    wx.navigateTo({
      url: '../classify/classify?keyword=' + e.currentTarget.dataset.key,
    })
  },
  goto_search_page(){
    wx.navigateTo({
      url: '../search/search',
    })
  },
  goto_job_detail(e){
    let job_id = e.currentTarget.dataset.jobid
    let merchantid = e.currentTarget.dataset.merchantid
    wx.navigateTo({
      url: '../job_detail/job_detail?job_id=' + job_id + "&merchantid=" + merchantid,
    })
  }
})